

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" >
<title>经典模式 | TinyMCE中文文档中文手册</title>
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="format-detection" content="telephone=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<script src="./tinymce.min.js?v562" ></script>
</head>


<body>
<div id="tinydemo">
</div>
<button onclick="getContent()"> 获取富文本内容 </button>

<script>
    var editor = null
    tinymce.init({
        selector: '#tinydemo',
        language:'zh_CN',
        initialValue: '',//初始值
        init_instance_callback: function(e){
            editor = e;
            var dom = document.getElementsByClassName('tox-statusbar')
            var domA = dom[0].getElementsByTagName('a')[0]
            if(domA){
                domA.innerText = '技术支持 新墨科技（使用字体时请注意字体版权）'
                domA.href = 'https://www.sinmore.com.cn/'
            }
        },
        height: '500px',
        language: 'zh_CN',
        plugins: 'table lists link image preview code anchor autolink autosave directionality fullpage pagebreak paste toc fullscreen searchreplace media codesample axupimgs formatpainter imagetools importword',
        toolbar: [
        'fontsizeselect bold italic strikethrough forecolor backcolor | alignleft aligncenter alignright alignjustify | indent outdent | numlist bullist',
        'link image axupimgs media importword | searchreplace anchor fullpage paste removeformat formatpainter | fullscreen'
        ],
        fontsize_formats: '12px 14px 16px 18px 24px 36px 48px 56px 72px',
        font_formats: '微软雅黑=Microsoft YaHei,Helvetica Neue,PingFang SC,sans-serif;苹果苹方=PingFang SC,Microsoft YaHei,sans-serif;宋体=simsun,serif;仿宋体=FangSong,serif;黑体=SimHei,sans-serif;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;思源=Source Han Sans CN;',
        relative_urls: false,
        autosave_prefix: 'richText',//自动保存 localstorageKey
        autosave_retention: '300m',//草稿有效时间
        autosave_interval: '10s',//草稿保存时间
        images_upload_handler: function(blobInfo, success, failure){
            //@todo 自定义上传图片
            success('https://www.igonovel.com/share/116/assets/images/invite-gift-box.png')
        },
    });

    function getContent(){
        if(editor){
            console.log(editor.getContent())
            return editor.getContent();
        }
    }
</script>
</body>
</html>